<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <ul id="ul">

    </ul>
    <script>
        var arr=[1,2,3,4];
        for(let i=0,len=arr.length;i<len;i++){
            var lis=document.createElement("li");
            lis.innerText=arr[i];
            lis.setAttribute("data-item",arr[i]);
            ul.appendChild(lis);
        }
        ul.addEventListener("click",function(event){
            console.log(event.target);
            console.log(event.target.getAttribute("data-item"));
            event.stopPropagation();
        },true)
    </script>
</body>
</html>